package com.yaolong.commons.base2;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 通用领域模型
 *
 * @author Yaolong
 * @since v1.0.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public abstract class BaseDomain implements Serializable {

	private static final long serialVersionUID = 1124163909325622987L;


	/**
	 * 创建时间
	 */
	@TableField(value = "Date_Created", fill = FieldFill.INSERT)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "修改时间")
	private LocalDateTime dateCreated;

	/**
	 * 修改时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField(value = "Date_Modified")
	@ApiModelProperty(value = "创建时间")
	private LocalDateTime dateModified;

	@TableField(value = "Created_By")
	@ApiModelProperty(value = "创建人ID")
	private Long createdBy;

	@TableField(value = "Modified_By")
	@ApiModelProperty(value = "修改人ID")
	private String modifiedBy;

	@TableField(value = "Created_By_Name")
	@ApiModelProperty(value = "创建人名称")
	private String createdByName;

	@TableField(value = "Modified_By_Name")
	@ApiModelProperty(value = "修改人名称")
	private String modifiedByName;

}
